/* 组件通用 start */

/* FE Form Element 表单元素中的 close */
span.icon {
  position: relative;
  flex-shrink: 0;
  height: var(--FormElementHeight);
  width: 16px;

  i {
    cursor: pointer;
    opacity: 1;
    position: absolute;
    left: 0;
    top: 0;
    transition: opacity var(--animationSpeed);
    color: var(--gray-7)
  }
}

/* dropdownMenu 通用样式 */
.dropdown {
  position: relative;
  .dropdownBox {
    position: absolute;
    min-width: 80px;
    left: 50%;
    top: calc(100% + 2px);
    transition: 280ms all 120ms ease-out;
    transform: rotateX(-90deg) translateX(-50%);
    transform-origin: top center;
    visibility: hidden;
    opacity: 0.3;
    padding: 0.3em 0;
    background-color: #fff;
    border-radius: 3px;
    box-shadow: 0 0.15em 0.25em rgba(black, 0.25);
    z-index: 999;

    li {
      opacity: 0;
      transition: 280ms all 120ms ease-out;
      outline: none;
      text-decoration: none;
    }
  }

  &:hover,
  &:focus-within {

    .dropdownBox {
      opacity: 1;
      transform: rotateX(0) translateX(-50%);
      visibility: visible;

      li {
        opacity: 1;
      }
    }
  }
}

/* dropdownMenu end*/
/* 组件清空图标按钮 */
span.activeClear {
  .icon-close {
    opacity: 1 !important;
  }

  .icon-rili {
    opacity: 0 !important;
  }
}

.FE.icon-close {
  color: #fff;
  font-size: 0.9em;
  opacity: 0;

  &::before {
    background-color: #ffa6a6;
    border-radius: 20px;
    padding: 2px;
    box-shadow: 0 0 3px 2px #ffe1e1;
  }
}

/* 组件通用 end*/

/* 清除 input 样式 */
.x-input-clean {
  border: none;
  width: 100%;
  height: 100%;

  &:focus {
    outline: none;
  }
}

.x-input, .x-textarea, .x-select, .x-date-picker {
  height: var(--FormElementHeight);
  line-height: var(--FormElementHeight);
  box-sizing: border-box;
  outline: none;
  border-radius: 2px;
  border: 1px solid var(--theme-border);
  font-size: var(--fontsize);
  transition: all .2s;
  color: rgba(0, 0, 0, 0.75);
  width: 100%;

  &:hover {
    border: 1px solid var(--gray-3);
    box-shadow: 0 0 3px 0 var(--gray-5);
  }
}

.x-element:hover {
  border: 1px solid var(--gray-3);
  box-shadow: 0 0 3px 0 var(--gray-5);
}

.x-element:focus {
  border-color: var(--theme-color);
  box-shadow: 0 0 3px 0 var(--theme-hover);
}

/*input*/
.x-input {
  padding: 0.3em 0.6em;
  background: transparent;
  line-height: 1.6em;

  &:hover {
    outline: none;
  }

  &:focus {
    border-color: var(--theme-color);
    box-shadow: 0 0 3px 0 var(--theme-hover);
  }
}

/*input end*/
/*button*/
.x-button {
  // Display
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: start; // Optional - see "Gotchas"
  cursor: pointer;

  // Visual
  background-color: var(--theme-color);
  color: #fff;
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.18);

  // Size
  padding: 0.5em 0.75em;
  min-width: 10ch;
  min-height: 24px;

  // Text
  text-align: center;
  line-height: 1.1;

  transition: 220ms all ease-in-out;
  border-radius: 2px;

  &:hover,&:active {
    background-color: var(--theme-hover);
  }
  &:focus {
    outline-style: solid;
    outline-color: transparent;
    box-shadow: 0 0 0 4px var(--theme-hover);
  }
}

/*button end*/

/*select*/
.x-select-box {
  display: inline-block;
  position: relative;
  box-sizing: border-box;
  height: var(--FormElementHeight);
  width: 100%;
  max-height: 100%;
  cursor: pointer;
  outline: none;
  border-radius: 2px;
  font-size: var(--fontsize);
  transition: all .3s;
  color: rgba(0, 0, 0, 0.75);

  &.expand {
    .options {
      display: block !important;
    }

    .x-select {
      border-color: var(--theme-color);
      box-shadow: 0 0 3px 0 var(--theme-hover);
    }
  }

  .x-select {
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 0.6em;
    overflow: hidden;

    span.text {
      width: 100%;
      text-align: left;
      outline: none;
      white-space: nowrap;

      &.placeholder {
        color: var(--gray-6);
        font-style: italic;
        font-size: 0.8em;
      }
    }

    span.icon {
      flex-shrink: 0;
      width: 16px;

      i {
      }
    }


  }

  .options {
    display: none;
    position: absolute;
    width: 100%;
    left: 0;
    top: 38px;
    line-height: 34px;
    max-height: calc(35px * 5);

    border: 1px solid #ccc;
    border-bottom-color: #bbb;
    box-shadow: 0 5px 15px -5px rgba(0 0 0 / 51%);
    background-color: #fff;
    z-index: 2002;
    overflow-y: auto;
    box-sizing: border-box;

    .option-item {
      text-align: left;
      padding: 0 0.7em;
      font-size: 0.9em;
      user-select: none;

      &:hover {
        background-color: var(--gray-1);
      }
    }

    .selected {
      background-color: rgba(var(--theme), .8) !important;
      font-weight: 700;
      color: #fff;
    }

    .empty {
      img {
        max-height: 150px;
        max-width: 100%;
      }
    }
  }
}

/*select end*/

/*switch*/
.x-switch-box {
  height: var(--FormElementHeight);
  box-sizing: border-box;
  width: 45px;
  display: inline-block;
  position: relative;

  &.checked {
    .x-switch {
      background-color: rgba(var(--theme), 0.9);

      &:after {
        left: 22px !important;

      }
    }
  }

  .x-switch {
    cursor: pointer;
    top: 50%;
    left: 50%;
    background-color: rgba(var(--theme), .25);
    transform: translate(-50%, -50%);
    display: inline-block;
    line-height: var(--FormElementHeight);
    position: relative;
    padding: 1px;
    transition: background-color var(--animationSpeed);
    //禁用
    &.disabled {
      cursor: not-allowed;
      box-sizing: border-box;
    }

    width: 40px;
    height: 20px;
    border-radius: 10px;
    box-sizing: border-box;
    align-items: center;

    &:after {
      content: ' ';
      position: absolute;
      height: 16px;
      width: 16px;
      background-color: #fff;
      border-radius: 16px;
      top: 2px;
      left: 2px;
      transition: left .18s;
    }

    &:active {
      box-shadow: 0 2px 3px rgba(0, 0, 0, 0.20), 0 2px 3px rgba(0, 0, 0, 0.1);
    }
  }
}

/*switch end*/

/*date-picker*/
.x-date-picker {
  padding: 0 0.6em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;

  &.active {
    border-color: var(--theme-color);
    box-shadow: 0 0 3px 0 var(--theme-hover);

    .x-date-dialog {
      display: block;

    }
  }


  .x-date-dialog {
    overflow: hidden;
    z-index: 1001;
    display: none;
    top: 38px;
    left: -1px;
    width: 300px;
    position: absolute;
    background-color: #fff;
    padding-top: 5px;
    border: 1px solid #ccc;
    border-bottom-color: #bbb;
    box-shadow: 0 5px 15px -5px rgb(0 0 0 / 51%);

    .control {
      display: flex;
      height: 50px;
      justify-content: space-between;
      align-items: center;
      padding: 0 10px;
      font-size: 1.1em;

      .btn {
        width: 30px;
        text-align: center;
        flex-shrink: 0;

        i:hover {
          color: var(--theme-color)
        }
      }

      .ym {
        flex-shrink: 0;
        font-size: 1.2em;
        margin: 0 0.4em;
        padding: 0 0.2em;
        cursor: pointer;
        border-bottom: 2px solid var(--gray-8);
        position: relative;

        &:hover {
          color: var(--theme-color);
          border-color: var(--theme-hover);
        }

        &.expand {
          .options {
            max-height: 175px;
            border: 1px solid #ccc;
            border-bottom-color: #bbb;
            box-shadow: 0 5px 15px -5px rgb(0 0 0 / 51%);
          }
        }

        .options {
          position: absolute;
          max-height: 0;
          overflow: hidden;
          top: 34px;
          left: 0;
          width: 100%;
          background-color: #fff;
          transition: all .2s;

          &:hover {
            overflow-y: auto;
          }

          li {
            font-size: 14px;
            line-height: 22px;
            height: 22px;
            color: var(--gray-8);
            padding-left: 1em;
            box-sizing: border-box;

            &:hover {
              color: var(--theme-color);
              background-color: var(--gray-2);
            }

            &.selected {
              background-color: rgba(var(--theme), .8) !important;
              color: #fff;
              font-weight: 700;
            }
          }
        }
      }
    }

    .content {
      padding: 0 10px 10px 10px;

      table {
        font-size: 11px;
        width: 100%;
        border-collapse: collapse;
        box-sizing: border-box;
        padding: 0;
        margin: 0;

        th {

          color: var(--gray-9);
          height: 24px;
          line-height: 24px;
        }

        .other-month {
          color: var(--gray-4);
        }

        td:nth-child(1), td:nth-child(2), td:nth-child(3), td:nth-child(4), td:nth-child(5) {
          font-weight: 700;
        }

        td {
          color: var(--gray-8);
          cursor: pointer;
          overflow: hidden;

          span {
            display: inline-block;
            width: 32px;
            height: 32px;
            line-height: 32px;
            border-radius: 16px;

            &:hover {
              background-color: var(--gray-2);
              color: var(--gray-8);
              transition: background-color .2s;
            }
          }
        }

        th, td {
          border: 1px solid #fff;
          text-align: center;
          user-select: none;
        }

        .today {
          color: var(--theme-hover);
          font-weight: 700;
        }

        .selected {
          span {
            background-color: rgba(var(--theme), .75) !important;
            color: var(--gray-1) !important;
            font-weight: 700;
            transition: background-color .2s;
          }
        }
      }
    }

  }
}

/*date-picker end*/


/* 通用列表页面样式 */
.listPage {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.75em;
  box-sizing: border-box;

  .header {
    background-color: #fff;
    padding: 10px;
  }

  .content {
    background-color: #fff;
    margin-top: 0.75em;
    padding: 1em;
    box-sizing: border-box;
    height: 100%;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }
}

/* 通用列表页面样式 end*/

/* 通用表单页面样式 */

/* 通用表单页面样式 end*/
